package ac.man.cs.afzal.tcm.main;

import ac.man.cs.afzal.tcm.nlp.XML_Tree_Generator;
import javax.swing.JFileChooser;

/**
 *
 * @author Hammad
 */
public class Term_Classification extends javax.swing.JFrame
{

    public String flag_training_corpus = "CORPUS";

    /** Creates new form Term_Classification */
    public Term_Classification()
    {
        initComponents();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroupCorpusTraining = new javax.swing.ButtonGroup();
        buttonGroup1 = new javax.swing.ButtonGroup();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanelTermLookup = new javax.swing.JPanel();
        jRadioButtonCorpus = new javax.swing.JRadioButton();
        jRadioButtonTraining = new javax.swing.JRadioButton();
        jLabelGenerateOccurrences = new javax.swing.JLabel();
        jButtonGenerateOccurrences = new javax.swing.JButton();
        jLabelTermLookup = new javax.swing.JLabel();
        jButtonTermLookup = new javax.swing.JButton();
        jLabelSentenceSplit = new javax.swing.JLabel();
        jButtonSentenceSplit = new javax.swing.JButton();
        jLabelTermMappingHeading = new javax.swing.JLabel();
        jLabelTermLookupHeading = new javax.swing.JLabel();
        jLabelTermMapping = new javax.swing.JLabel();
        jButtonTermMapping = new javax.swing.JButton();
        jPanelLexicalSimilarity = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jFileChooser1 = new javax.swing.JFileChooser();
        jButton1 = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jLabelConvertPenntoXML = new javax.swing.JLabel();
        jButtonConvert = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jTabbedPane1.setFont(new java.awt.Font("Tahoma", 1, 11));

        buttonGroupCorpusTraining.add(jRadioButtonCorpus);
        jRadioButtonCorpus.setText("Corpus");
        jRadioButtonCorpus.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jRadioButtonCorpusStateChanged(evt);
            }
        });
        jRadioButtonCorpus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonCorpusActionPerformed(evt);
            }
        });

        buttonGroupCorpusTraining.add(jRadioButtonTraining);
        jRadioButtonTraining.setText("Training");
        jRadioButtonTraining.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonTrainingActionPerformed(evt);
            }
        });

        jLabelGenerateOccurrences.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabelGenerateOccurrences.setText("Generate files for occurrences from clist files");

        jButtonGenerateOccurrences.setText("Start");
        jButtonGenerateOccurrences.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonGenerateOccurrencesActionPerformed(evt);
            }
        });

        jLabelTermLookup.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabelTermLookup.setText("Mark boundry of terms and sentences in documents");

        jButtonTermLookup.setText("Start");

        jLabelSentenceSplit.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabelSentenceSplit.setText("Generate seperate files for each occurrence in a sentence");

        jButtonSentenceSplit.setText("Start");

        jLabelTermMappingHeading.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabelTermMappingHeading.setText("Term Mapping");

        jLabelTermLookupHeading.setFont(new java.awt.Font("Tahoma", 1, 18));
        jLabelTermLookupHeading.setText("Term Lookup");

        jLabelTermMapping.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabelTermMapping.setText("Perform Term Mapping (Populate the term_mapping table)");

        jButtonTermMapping.setText("Start");
        jButtonTermMapping.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonTermMappingActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelTermLookupLayout = new javax.swing.GroupLayout(jPanelTermLookup);
        jPanelTermLookup.setLayout(jPanelTermLookupLayout);
        jPanelTermLookupLayout.setHorizontalGroup(
            jPanelTermLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelTermLookupLayout.createSequentialGroup()
                .addGap(50, 50, 50)
                .addComponent(jRadioButtonCorpus)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 131, Short.MAX_VALUE)
                .addComponent(jRadioButtonTraining)
                .addGap(299, 299, 299))
            .addGroup(jPanelTermLookupLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabelTermMappingHeading)
                .addContainerGap(463, Short.MAX_VALUE))
            .addGroup(jPanelTermLookupLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelTermLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelTermLookupLayout.createSequentialGroup()
                        .addComponent(jLabelTermMapping)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButtonTermMapping))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanelTermLookupLayout.createSequentialGroup()
                        .addGroup(jPanelTermLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabelSentenceSplit)
                            .addComponent(jLabelTermLookup)
                            .addComponent(jLabelGenerateOccurrences)
                            .addComponent(jLabelTermLookupHeading))
                        .addGap(18, 18, 18)
                        .addGroup(jPanelTermLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButtonSentenceSplit)
                            .addComponent(jButtonTermLookup)
                            .addComponent(jButtonGenerateOccurrences))))
                .addContainerGap(191, Short.MAX_VALUE))
        );
        jPanelTermLookupLayout.setVerticalGroup(
            jPanelTermLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelTermLookupLayout.createSequentialGroup()
                .addGroup(jPanelTermLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jRadioButtonTraining)
                    .addComponent(jRadioButtonCorpus))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelTermLookupHeading)
                .addGap(18, 18, 18)
                .addGroup(jPanelTermLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelGenerateOccurrences)
                    .addComponent(jButtonGenerateOccurrences))
                .addGap(18, 18, 18)
                .addGroup(jPanelTermLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jButtonTermLookup, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelTermLookup, javax.swing.GroupLayout.Alignment.LEADING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanelTermLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelSentenceSplit)
                    .addComponent(jButtonSentenceSplit))
                .addGap(18, 18, 18)
                .addComponent(jLabelTermMappingHeading)
                .addGap(18, 18, 18)
                .addGroup(jPanelTermLookupLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelTermMapping)
                    .addComponent(jButtonTermMapping))
                .addContainerGap(279, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Terms Manager", jPanelTermLookup);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel1.setText("Source Terms");

        jButton1.setText("jButton1");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelLexicalSimilarityLayout = new javax.swing.GroupLayout(jPanelLexicalSimilarity);
        jPanelLexicalSimilarity.setLayout(jPanelLexicalSimilarityLayout);
        jPanelLexicalSimilarityLayout.setHorizontalGroup(
            jPanelLexicalSimilarityLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelLexicalSimilarityLayout.createSequentialGroup()
                .addGap(31, 31, 31)
                .addComponent(jLabel1)
                .addGap(28, 28, 28)
                .addComponent(jButton1)
                .addContainerGap(392, Short.MAX_VALUE))
        );
        jPanelLexicalSimilarityLayout.setVerticalGroup(
            jPanelLexicalSimilarityLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelLexicalSimilarityLayout.createSequentialGroup()
                .addGap(55, 55, 55)
                .addGroup(jPanelLexicalSimilarityLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jButton1))
                .addContainerGap(445, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Lexical Comparison", jPanelLexicalSimilarity);

        jLabelConvertPenntoXML.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabelConvertPenntoXML.setText("Convert Penn to XML:");

        jButtonConvert.setText("Convert");
        jButtonConvert.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonConvertActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabelConvertPenntoXML)
                .addGap(18, 18, 18)
                .addComponent(jButtonConvert)
                .addContainerGap(367, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(33, 33, 33)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelConvertPenntoXML)
                    .addComponent(jButtonConvert))
                .addContainerGap(467, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Sentence Manager", jPanel1);

        getContentPane().add(jTabbedPane1, java.awt.BorderLayout.PAGE_START);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jRadioButtonCorpusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonCorpusActionPerformed
        // TODO add your handling code here:
        flag_training_corpus = "Corpus";

    }//GEN-LAST:event_jRadioButtonCorpusActionPerformed

    private void jButtonGenerateOccurrencesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGenerateOccurrencesActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButtonGenerateOccurrencesActionPerformed

    private void jRadioButtonCorpusStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jRadioButtonCorpusStateChanged
        // TODO add your handling code here:
    }//GEN-LAST:event_jRadioButtonCorpusStateChanged

    private void jRadioButtonTrainingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonTrainingActionPerformed
        // TODO add your handling code here:
        flag_training_corpus = "Training";
    }//GEN-LAST:event_jRadioButtonTrainingActionPerformed

    private void jButtonTermMappingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonTermMappingActionPerformed
        // TODO add your handling code here:
        // Term_Mapping term_mapping = new Term_Mapping_Impl();
        // term_mapping.terms_mapping(""); // other argument option is "unified_terms"
    }//GEN-LAST:event_jButtonTermMappingActionPerformed

    private void jButtonConvertActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonConvertActionPerformed
    {//GEN-HEADEREND:event_jButtonConvertActionPerformed
        XML_Tree_Generator tree_conversion = new XML_Tree_Generator();
        tree_conversion.convert_penn_to_xml();
        // TODO add your handling code here:
    }//GEN-LAST:event_jButtonConvertActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton1ActionPerformed
    {//GEN-HEADEREND:event_jButton1ActionPerformed
        JFileChooser file_chooser = new JFileChooser();        // TODO add your handling code here:
    }//GEN-LAST:event_jButton1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[])
    {
        java.awt.EventQueue.invokeLater(new Runnable()
        {

            public void run()
            {
                new Term_Classification().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroupCorpusTraining;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButtonConvert;
    private javax.swing.JButton jButtonGenerateOccurrences;
    private javax.swing.JButton jButtonSentenceSplit;
    private javax.swing.JButton jButtonTermLookup;
    private javax.swing.JButton jButtonTermMapping;
    private javax.swing.JFileChooser jFileChooser1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabelConvertPenntoXML;
    private javax.swing.JLabel jLabelGenerateOccurrences;
    private javax.swing.JLabel jLabelSentenceSplit;
    private javax.swing.JLabel jLabelTermLookup;
    private javax.swing.JLabel jLabelTermLookupHeading;
    private javax.swing.JLabel jLabelTermMapping;
    private javax.swing.JLabel jLabelTermMappingHeading;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanelLexicalSimilarity;
    private javax.swing.JPanel jPanelTermLookup;
    private javax.swing.JRadioButton jRadioButtonCorpus;
    private javax.swing.JRadioButton jRadioButtonTraining;
    private javax.swing.JTabbedPane jTabbedPane1;
    // End of variables declaration//GEN-END:variables
}
